package com.fortune.dao;

import java.util.Date;
import java.util.List;

import com.fortune.vo.dStoreIn.StorageDetails;
import org.apache.ibatis.annotations.Param;

import com.fortune.constants.enums.ProductStock;
import com.fortune.vo.mStoreOut.ProduceDetailIn;
import com.fortune.vo.productStockDetailInfo.ProductStockDetailInfo;

/**
 * Created by Administrator on 2018/5/28 0028.
 */
public interface DproductStockDetailInfoDao {

    /**
     * 添加商品库存明细账-验收入库
     * @param date
     * @param productStock
     * @param list
     * @return
     */
    int insertProductStockDetail(@Param("did")String did,@Param("date") Date date, @Param("productStock") ProductStock productStock, @Param("list") List<ProductStockDetailInfo> list);

    /**
     * 添加商品库存明细账-初始化入库
     * @param date
     * @param productStock
     * @param list
     * @return
     */
    int insertInitProductStockDetail(@Param("did")String did, @Param("date") Date date, @Param("productStock") ProductStock productStock, @Param("list") List<ProductStockDetailInfo> list);

    /**
     * 查询最大流水号
     * @param companyId
     * @param storeId
     * @param produceId
     * @return
     */
    int queryMax(@Param("did") String did,@Param("storeId") String storeId,@Param("produceId") String produceId);

    /**
     * 查询最后初始化入库或生产入库数据
     * @param companyId
     * @param storeId
     * @param produceId
     * @return
     */
    List<ProductStockDetailInfo> queryLastStockDetail(@Param("did") String did,@Param("storeId") String storeId,@Param("produceId") String produceId);

    /**
     * 添加初始化入库或生产入库明细
     * @param companyId
     * @param productStock
     * @param info
     * @param order
     * @return
     */
    int insertSingleInProductStockDetail(@Param("companyId") String companyId,@Param("did")String did,@Param("productStock") ProductStock productStock,@Param("info") ProductStockDetailInfo info,@Param("order") int order);

    int insertStorageProductStockDetail(@Param("companyId") String companyId,@Param("did")String did,@Param("info") StorageDetails info,@Param("order") int order);

    /**
     * 查询最后出库数据
     * @param companyId
     * @param storeId
     * @param produceId
     * @return
     */
    List<ProductStockDetailInfo> queryLastOutStockDetail(@Param("companyId") String companyId,@Param("storeId") String storeId,@Param("produceId") String produceId);

    int insertSingleOutProductStockDetail(@Param("companyId") String companyId, @Param("shipSoreId") String shipSoreId, @Param("productStock") ProductStock productStock, @Param("info") ProduceDetailIn info, @Param("order") int order, @Param("remainNum") int remainNum);

    String getCostUnitPrice(@Param("dId") String dId, @Param("storeId") String storeId, @Param("mId") String mId, @Param("mPId") String mPId);
}
